package com.flash.BusinessProcess.controller;


import com.flash.BusinessData.entity.DealData;
import com.flash.BusinessData.service.DealDataService;
import com.flash.BusinessProcess.entity.Settlement;
import com.flash.BusinessProcess.service.SettlementService;
import com.flash.GlobalManagement.util.Dbutil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class SettlementController {

    @Autowired
    SettlementService settlementService;

    @RequestMapping("/SettlementMap")
    public Map SettlementMap(Settlement settlement, int page, int limit){
        System.out.println("未结算的查询语句");
        HashMap map = new HashMap();
        List<Settlement> settlementList = settlementService.SettlementMap(settlement, page, limit);
        int i = settlementService.selectCountSettlement();
        System.out.println(settlementList);
        map.put("code",0);
        map.put("msg","");
        map.put("data",settlementList);
        map.put("count",i);
        return map;
    }


    @RequestMapping("/SettlementMapFan")
    public Map SettlementMapFan(Settlement settlement, int page, int limit){
        System.out.println("已结算的查询语句");
        System.out.println("settlement:"+settlement);
        HashMap map = new HashMap();
        List<Settlement> settlements = settlementService.SettlementMapFan(settlement, page, limit);
        int i = settlementService.selectCountSettlement();
        System.out.println(settlements);
        map.put("code",0);
        map.put("msg","");
        map.put("data",settlements);
        map.put("count",i);
        return map;

    }


    @RequestMapping("/updateSettlement")
    public int updateSettlement(String settlement){
        System.out.println("修改");
        int i = settlementService.updateSettlement(settlement);
        System.out.println(i);
        return i;
    }

    @RequestMapping("updateSettlementFan")
    public int updateSettlementFan(String settlement){
        System.out.println("修改");
        int i = settlementService.updateSettlementFan(settlement);
        System.out.println(i);
        return i;
    }
}
